﻿<%@ Page CodeFileBaseClass="AliCMS.Lib.SystemPageBase" %>
<ali:Get ID="Rewrite" Object="Rewrite" InnerID="Request.QueryString['ID']" Validate="True" />
<script language="c#" runat="server">
protected string GetNamespace(object instanceID)
{
	return Manager.Instances.Select(Alias.Instance.ID + "='" + instanceID + "'")[0][Alias.Module.Namespace].ToString();
}
</script>
<section data-page="rewrite_edit" data-title="编辑网址重写" data-id="<%=Request.QueryString["ID"]%>" data-object-full-name="<%=Rewrite[ObjectFullName]%>" data-operation="<%=Rewrite[Operation]%>">
	<dl class="path1">
		<dt><span>您的位置：</span><a href="list.aspx?Lang=<%=ContentLang%>" target="ali-navtab">网址重写</a> → <b><%=Rewrite[LookFor]%></b></dt>
	</dl>
	<form action="" class="post">
		<div class="post-body">
			<table class="post-table margin2">
				<tr>
					<th>需重写的地址：</th>
					<td><input name="LookFor" value="<%=HttpUtility.HtmlEncode(Convert.ToString(Rewrite[LookFor]))%>" size="60" class="ali-input"> 格式为正则表达式。必须以http://或者~/开头。系统会全字匹配，即前面会加上^，结尾会加上$。</td>
				</tr>
				<tr>
					<th>用户代理：</th>
					<td><input name="UserAgent" value="<%=Rewrite[UserAgent]%>" size="60" class="ali-input"> 格式为正则表达式</td>
				</tr>
				<tr>
					<th>重定向方式：</th>
					<td>
						<%If Convert.ToString(Rewrite[Type]) == "Exception"%>
							<label><input type="radio" name="Type" value="Address">网址</label>
							<label><input type="radio" name="Type" value="Instance">实例</label>
							<label><input type="radio" name="Type" value="Exception" checked>例外</label>
						<%ElseIf Convert.ToString(Rewrite[Type]) == "Instance"%>
							<label><input type="radio" name="Type" value="Address">网址</label>
							<label><input type="radio" name="Type" value="Instance" checked>实例</label>
							<label><input type="radio" name="Type" value="Exception">例外</label>
						<%Else%>
							<label><input type="radio" name="Type" value="Address" checked>网址</label>
							<label><input type="radio" name="Type" value="Instance">实例</label>
							<label><input type="radio" name="Type" value="Exception">例外</label>
						<%EndIf%>
					</td>
				</tr>
				<tr data-name="SendTo">
					<th>重定向的地址：</th>
					<td><input name="SendTo" value="<%=Rewrite[SendTo]%>" size="60" class="ali-input"><br>可以获取重写地址中的组值，格式为：(组名)</td>
				</tr>
				<tr data-name="Is301">
					<th>301转向：</th>
					<td>
						<%If Convert.ToBoolean(Rewrite[Is301])%>
							<label><input type="checkbox" name="Is301" checked>301转向</label>
						<%Else%>
							<label><input type="checkbox" name="Is301" >301转向</label>
						<%EndIf%>
					</td>
				</tr>
				<tr data-name="InstanceID">
					<th>实例：</th>
					<td>
						<select name="InstanceID" data-class="<%=ContentLang%>Font" data-ali-widget="combo">
							<option value="">--未指定--</option>
							<ali:List Object="Instance">
								<ali:Record>
									<%If Guid.Equals(ID, Rewrite[InstanceID])%>
										<option value="<%=ID%>" data-namespace="<%=GetNamespace(ID)%>" selected><%=Name%></option>
									<%Else%>
										<option value="<%=ID%>" data-namespace="<%=GetNamespace(ID)%>"><%=Name%></option>
									<%EndIf%>
								</ali:Record>
							</ali:List>
						</select>
					</td>
				</tr>
				<tr data-name="ObjectFullName">
					<th>对象：</th>
					<td>
						<select name="ObjectFullName" data-ali-widget="combo"><option value="">--未指定--</option></select>
					</td>
				</tr>
				<tr data-name="Operation">
					<th>操作：</th>
					<td>
						<select name="Operation" data-ali-widget="combo"><option value="">--未指定--</option></select>
					</td>
				</tr>
				<tr data-name="Lang">
					<th>语言：</th>
					<td>
						<select name="Lang" data-class="<%=ContentLang%>Font" data-ali-widget="combo">
							<ali:List Mark="System" Object="Language">
								<ali:Record>
									<%If Convert.ToString(Ab) == Convert.ToString(Rewrite[Lang])%>
										<option value="<%=Ab%>" selected><%=Name%></option>
									<%Else%>
										<option value="<%=Ab%>"><%=Name%></option>
									<%EndIf%>
								</ali:Record>
							</ali:List>
						</select>
					</td>
				</tr>
			</table>
		</div>
		<div class="post-footer"><button type="submit" class="ali-button">保 存</button></div>
	</form>
</section>